package weapons;

import iterfaces.Ships;
import ships.Destroyer;
import ships.Frigate;
import ships.Hunter;
import controllers.Map;
import controllers.Point;
import controllers.State;

/**
 * @author 508461
 * @version 1.0
 * @created 24-mei-2012 12:47:47
 */
public class Goalkeeper extends Weaponsystem {

	private int dead_angle;
	private int fire_rate;
	private int magazine_size;
	private State state;
	public Radar radar;
	public BulletCloud bulletCloud;
	private Ships ship;
	
	private static final int MAGAZINE_SIZE 						= 25;
	private static final int MAX_HEALTHPOINTS_BEFORE_SHUTDOWN	= 50; //in %
	private static final int RELOAD_TIME 						= 120; //sec	
	private static final int MAGAZINE_AMOUNT 					= 75;
	private static final int FIRE_RATE 							= 1; //= 1bulletclouad/1 seconde
	private int remainingBullets;

	public static void main(String[] args){
		// Test de verbonden classes.
		new Goalkeeper();
	}
	
	public Goalkeeper(){
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		this.radar = new Radar();
		
		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	public Goalkeeper(Ships ship){
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		this.ship = ship;

		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	public int getDeadAngle(){
		return this.dead_angle;
	}
	
	public void setDeadAngle(int dead_angle)
	{
		this.dead_angle = dead_angle;
	}
	
	public int getFireRate(){
		return this.fire_rate;
	}
	
	public void setFireRate(int fire_rate)
	{
		this.fire_rate = fire_rate;
	}

	public int getMagazineSize(){
		return this.magazine_size;
	}
	
	public void setMagazineSize(int magazine_size)
	{
		this.magazine_size = magazine_size;
	}

	public State getState(){
		return this.state;
	}
	
	public void setState(State state)
	{
		this.state = state;
	}

	public void shoot(Point point, Point shoot){
		Bullet bulletCloud = new BulletCloud(this.ship.getPosition());
		//bulletCloud.addWaypoint(bulletCloud, point);
		bulletCloud.setDrawWaypoints(false);
		Map.getMap().addDrawAbleObject(bulletCloud);
		//Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1).addWaypoint(Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1), shoot);
		bulletCloud.addWaypoint(bulletCloud, shoot);
	}

	public void finalize() throws Throwable {
		super.finalize();
	}

}